package com.health.adapter;

import java.util.ArrayList;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.ViewGroup;

public class FragmentAdapter extends FragmentPagerAdapter {
	private ArrayList<Fragment> fragments;
	private Fragment currentFragment;

	public FragmentAdapter(FragmentManager fm, ArrayList<Fragment> fragments) {
		super(fm);
		this.fragments = fragments;
	}

	@Override
	public Fragment getItem(int id) {
		return fragments.get(id);
	}

	@Override
	public int getCount() {
		return fragments.size();
	}

	@Override
	public void setPrimaryItem(ViewGroup container, int position, Object object) {
		currentFragment = (Fragment)object;
		super.setPrimaryItem(container, position, object);
	}

	public Fragment getCurrentFragment() {
		return currentFragment;
	}
	
	
}
